﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;

using Boggle;
using Boggle.Client;

namespace Boggle.Client.Tests
{
	/// <summary>
	/// Tests the WordStatusToStringConverter.
	/// </summary>
	public class TestWordStatusToStringConverter
	{
		/// <summary>
		/// Tests the Convert method.
		/// </summary>
		[Test, TestCaseSource("GetConvertCases")]
		public Object TestConvert(Word.Status status)
		{
			var converter = new WordStatusToStringConverter();
			return converter.Convert(status, typeof(String), null, null);
		}

		/// <summary>
		/// Provides test cases for the Convert test.
		/// </summary>
		/// <returns>Test cases for the Convert test method.</returns>
		public IEnumerable<ITestCaseData> GetConvertCases()
		{
			yield return new TestCaseData(Word.Status.Error).Returns("Error");
			yield return new TestCaseData(Word.Status.NotAWord).Returns("Not a word");
			yield return new TestCaseData(Word.Status.NotInGrid).Returns("Not found in grid");
			yield return new TestCaseData(Word.Status.Validated).Returns("Validated");
			yield return new TestCaseData(Word.Status.Validating).Returns("Looking up...");
		}

        /// <summary>
        /// Tests the ConvertBack method.
        /// </summary>
        [Test, ExpectedException(typeof(NotImplementedException))]
        public void TestConvertBack()
        {
            var converter = new WordStatusToStringConverter();
            converter.ConvertBack("Error", typeof(Word.Status), null, null);
        }
	}
}
